<template>
  <div class="news-detail">
    <my-header mytitle="资讯详情"></my-header>
    <div>
      <h1 class="news-title">{{ content.title }}</h1>
      <p class="news-info">
        <span>{{content.add_time | fmtTime}}</span>
        <span>{{ content.click }}</span>
        <span>亚洲图片</span>
      </p>
    </div>
    <div class="news-content" v-html="content.content"></div>
    <comment :id="$route.params.id"></comment>
    <tab-bar></tab-bar>
  </div>
</template>
<script>
import {getNewDetail} from '@/api'
import MyHeader from '@/components/my-header'
import comment from '@/components/comment'
import TabBar from '@/components/tab-bar'
export default {
  components: {
    MyHeader,
    comment,
    TabBar
  },
  data () {
    return {
      content: {}
    }
  },
  methods: {
    initRender () {
      getNewDetail(this.$route.params.id)
        .then(res => {
          console.log(res)
          this.content = res.message[0]
          res.message[0].click += 1
        })
    }
  },
  mounted () {
    this.initRender()
  }
}
</script>
<style lang="scss" scoped>
.news-detail {
  padding: 40px 0 55px 0;
  .news-title {
    font-size: 14px;
    font-weight: bold;
  }
  .news-info {
    font-size: 12px;
    color: #26a2ff;
    display: flex;
    justify-content: space-between;
  }
  .news-content {
    font-size: 12px;
  }
}
</style>
